// 云函数入口文件
const cloud = require('wx-server-sdk')
// 初始化 cloud
cloud.init({
  // API 调用都保持和云函数当前所在环境一致
  traceUser: true,
  env: 'micro-i98sq'
});
const db = cloud.database();
// 云函数入口函数
exports.main = async (event, context) => {
  var _id = event._id;
  var movieid = event.movieid;
  let result = [];
  cloud.database().collection("collect").aggregate()
    .lookup({
      from: "movies",
      localField: 'movieid',
      foreignField: '_id',
      as: 'uapproval'
    }).end().then(res => result = res)
console.log(result)
  return {
    result
  }
}